home *** CD-ROM | disk | FTP | other *** search
- #include "bbs.h"
-
- extern UBYTE NewSinceFlag;
-
- static FILE *fp1 = NL; /* RTS Thu Jan 16 16:24:58 1992 global in mycore2.c */
-
- static int TmpDisplayIt(void)
- {
- int MoreStat,stat;
- char str[200];
-
- while(fgets(str,180,fp1)!=NULL)
- {
- //str[181]='\0';
- if(str[strlen(str)-1]=='\n') {
- if(gnsflag!=1) LineCount++;
- strcat(str,"\r");
- }
- AEPutStr(str);
- if(SCheckInput()) {
- stat=ReadChar(1L);
- if(stat<0)
- return(stat);
-
- switch(stat) {
- case '\023': /* Pause */
- stat=ReadChar(KEYBOARD_TIMEOUT);
- if(stat<0)
- return(NO_CARRIER);
- break;
- case '\003': /* ^C */
- AEPutStr("**Break\r\n\r\n");
- return(FAILURE);
- }
- }
- MoreStat=FlagPause(0);
- if(MoreStat<0)
- return(MoreStat);
-
- }
- return(SUCCESS);
- }
-
-
- int MyNewFiles(void)
- {
- int month,day,year;
- int tv,mystat,stat,Comstat;
- int FLLoop;
- char tempfile[256]; //(RTS) for buffer of upload dir
- char c[256];
- char str[200],ray[200];
- char fn[81],sz[81],dt[81],cmt[81];
- int mdt,ddt,ydt;
- long TimeVar;
- int fcopy = FALSE;
-
- gnsflag=0;
- LineCount = 0;
-
- AEPutStr("\r\n");
- if(MaxDirs==0) {
- MyError(5); // Sorry();
- return(FAILURE);
- }
-
- TimeVar=User.NewSinceDate;
- sprintf(str,"%s",ctime(&TimeVar));
- Convert_CTime_To_Date(str,ray,c);
-
- str[0]='\0';
-
- Comstat=CommandSplit();
- if(Comstat>1) {
- if(Command[1][0]=='s'||Command[1][0]=='S') strcpy(str,ray);
- else strcpy(str,Command[1]);
- }
-
- while(strlen(str)!=8) {
- Comstat=1;
- sprintf(str,"Date as (mm-dd-yy) to search from (Enter)=%s: ",ray);
- AEPutStr(str);
- mystat=LineInput("",str,8,KEYBOARD_TIMEOUT);
- if(mystat<0) return(NO_CARRIER);
- if(strlen(str)==0) strcpy(str,ray);
- if(strlen(str)!=8) AEPutStr("\r\n");
- }
- sprintf(c,"\tDirectory Scan for (%s)\n",str);
- (void)CallersLog(c);
-
- str[2]=' ';
- str[5]=' ';
- sscanf(str,"%d %d %d",&month,&day,&year);
-
- tv = 0;
-
- if(Comstat>2) {
- strcat(Command[2]," ");
- strcat(Command[2],Command[3]);
- mystat=GetDirSpan(Command[2]);
- } else mystat=GetDirSpan("\0");
-
- if(mystat==FAILURE) return(SUCCESS);
-
- gnsflag=CheckForNS(MAINMENU_Li);
-
- NewSinceFlag=1;
- fcopy = FALSE;
-
- FLLoop=StartDir;
- while(FLLoop<=DirScan) {
- strcpy(str,Conference_Location);
- if(DirScan!=(-1)) {
- //(RTS) buffer upload dir
- if(FLLoop == MaxDirs) {
- strcat(str,"DIR");
- sprintf(ray,"%d",FLLoop);
- strcat(str,ray);
- sprintf(ray,"Scanning directory %d\r\n",FLLoop);
- AEPutStr(ray);
-
- sprintf(tempfile,"T:tdir.%d",Cmds->AcLvl[LVL_NODE_NUMBER]);
- /* now copy to T: and use T: copy */
- if((FileCopy(str,tempfile))) {
- strcpy(str,tempfile);
- fcopy = TRUE;
- }
-
- } else {
- strcat(str,"DIR");
- sprintf(ray,"%d",FLLoop);
- strcat(str,ray);
- sprintf(ray,"Scanning directory %d\r\n",FLLoop);
- AEPutStr(ray);
- }
- } else {
- strcat(str,"hold/held");
- AEPutStr("Scanning directory HOLD\r\n");
- }
- stat=FlagPause(1);
- if(stat<0) {
- if(fcopy) DeleteFile(tempfile);
- return(stat);
- }
- fp1 = fopen(str,"r");
- if(fp1==NULL) {
- AEPutStr("No Files are available.\r\n\r\n");
- if(fcopy) DeleteFile(tempfile);
- return(SUCCESS);
- }
-
-
- while(fgets(c,250,fp1)!=NULL) {
- c[250]='\0';
- if(c[0]==' '||c[0]=='\0'||c[0]=='\n')
- continue;
- sscanf(c,"%s %s %s %s",&fn,&sz,&dt,&cmt);
- if(dt[0]<='9'&&dt[0]>='0'&&strlen(dt)==8){
- if(!(dt[2]=='-'&&dt[5]=='-'&&dt[6]<='9'&&dt[6]>='0')) {
- strcpy(sz,dt);
- strcpy(dt,cmt);
- }
- } else {
- strcpy(sz,dt);
- strcpy(dt,cmt);
- }
- dt[2]=' ';
- dt[5]=' ';
- sscanf(dt,"%d %d %d",&mdt,&ddt,&ydt);
- if(ydt>year) tv = 1;
-
- else {
- if(ydt==year) {
- if(mdt>month) tv = 1;
- else if(mdt==month) {
- if(ddt>=day) tv = 1;
- }
- }
- }
- if(tv) break;
- }
-
- if(tv!=0) {
- c[strlen(c)-1]='\0';
- AEPutStr(c);
- AEPutStr("\r\n");
- stat=FlagPause(1);
- if(stat<0) {
- fclose(fp1);
- if(fcopy) DeleteFile(tempfile);
- return(stat);
- }
-
- // stat=DisplayIt(); /* Mikes unbuffered */
- stat=TmpDisplayIt(); /* my buffered dir code */
- fclose(fp1);
- tv=0;
- if(stat<0) {
- if(fcopy) DeleteFile(tempfile);
- return(stat);
- }
- } else fclose(fp1);
-
- FLLoop+=1;
- }
- AEPutStr("\r\n");
- gnsflag=0;
- if(fcopy) DeleteFile(tempfile);
- return(SUCCESS);
- }
-